package com.springboot;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class MainController {
	
	@Autowired
	JdbcTemplate jdbcTemplate;
	
	@RequestMapping("index")
	public ModelAndView  index(){
		ModelAndView mv = new ModelAndView("index");
		System.out.println(jdbcTemplate);
		List<Map<String, Object>>  result = jdbcTemplate.queryForList("select * from a");
		mv.addObject("result",result.get(2).get("p_id"));
		return  mv;
	}
}
